/*
 * Copyright 2006 Matt Jensen
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
package org.spectaql.metadata;

import java.io.Serializable;
import java.lang.reflect.Method;

/**
 * <p>
 * <code>PropertyMetadata</code> holds metadata on a single property for a persistent entity class.
 * </p>
 */
public interface PropertyMetadata extends Serializable
{
    /**
     * <p>
     * Get the property name.
     * </p>
     *
     * @return {@link String} property name.
     */
    String getName();

    /**
     * <p>
     * Get the identifier property flag.
     * </p>
     *
     * @return <code>boolean</code> identifier property flag.
     */
    boolean isIdentifierProperty();

    /**
     * <p>
     * Get the nullability flag.
     * </p>
     *
     * @return <code>boolean</code> nullability flag.
     */
    boolean isNullable();

    /**
     * <p>
     * Get the property class.
     * </p>
     *
     * @return {@link Class} property class.
     */
    Class<?> getPropertyClass();

    /**
     * <p>
     * Get the property accessor method.
     * </p>
     *
     * @return {@link Method} instance.
     */
    Method getReadMethod();

    /**
     * <p>
     * Get the property mutator method, if any. 
     * </p>
     *
     * @return {@link Method} instance or <code>null</code> if the property is read-only.
     */
    Method getWriteMethod();
}
